<template>
  <basic-container>
    <el-tabs v-model="activeName" @tab-click="handleClick">
      <el-tab-pane label="出售中的商品"
                   name="first">
        <goods @flush-list="flusha"
               ref="first"
               :goodsStatus="0" />
      </el-tab-pane>
      <el-tab-pane label="仓库中的商品"
                   name="second">
        <goods @flush-list="flusha"
               :goodsStatus="1"
               ref="second" />
      </el-tab-pane>
      <el-tab-pane label="审核中的商品"
                   name="third">
        <goods :goodsStatus="2"
               ref="third" />
      </el-tab-pane>
      <el-tab-pane label="审核拒绝的商品"
                   name="five">
        <goods :goodsStatus="3"
               ref="five" />
      </el-tab-pane>
      <el-tab-pane label="违规下架商品"
                   name="fourth">
        <goods :goodsStatus="-2"
               ref="fourth" />
      </el-tab-pane>
    </el-tabs>
  </basic-container>
</template>

<script>
import Vue from "vue";
import goods from "@/components/goods/seller/goods";
// 事件监听机制
const Event = new Vue();
export default {
  data () {
    return {
      activeName: "first",
      Event
    };
  },
  components: {
    goods
  },
  created() {
	  if( localStorage.getItem('activeName')){
		  this.activeName=localStorage.getItem('activeName')
		  setTimeout(()=>{
			  localStorage.removeItem('activeName')
		  },500)
	  }
  },
  methods: {
    flusha (param) {
      this.$refs[param].refreshChange()
    },
    handleClick(el){
      this.$refs[el.name].refreshChange()
    },
  }
};
</script>

<style scoped lang="scss">
</style>
